/**

 @Name：layuiAdmin（iframe版） 广告管理
 @Author：贤心
 @Site：http://www.layui.com/admin/
 @License：LPPL

 */
layui.define(['admin', 'table', 'util','upload'], function (exports) {
    var $ = layui.$, admin = layui.admin, table = layui.table, element = layui.element, form = layui.form,util = layui.util, upload = layui.upload;
    var addtime = function(d){
        return util.toDateString(d.addtime*1000,'yyyy-MM-dd HH:mm:ss');
    };
    //全部数据
    var active = {
        //调用添加页面
        direct: function () {
            layer.confirm('确定要清除空闲图片吗？', function () {
                admin.req({
                    url: '/shengteng/attachment/clear/'
                    , type: 'post'
                    , success: function (res) {
                        layer.closeAll('dialog');
                        if (res.code == 0) {
                            layer.msg(res.msg, {icon: 1, time: 1000}, function () {
                                location.reload();
                            });
                        }
                    }
                });
            });
        }
    };
    $('.clt-auth-btns .layui-btn').on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
    exports('attachment', {});
});
